06. Formulating Portfolio Optimization Problems

Formulating Portfolio Optimization Problems

So far, we've discussed one way to formulate a portfolio optimization problem. We learned to set the portfolio variance as the objective function, while imposing the constraint that the portfolio weights should sum to 1. However, in practice you may frame the problem a little differently. Let's talk about some of the different ways to set up a portfolio optimization problem.

Common Constraints

There are several common constraints that show up in these problems. Earlier, we were allowing our portfolio weights to be negative or positive, as long as they summed to 1. If a weight turned out to be negative, we would consider the absolute value of that number to be the size of the short position to take on that asset. If your strategy does not allow you to take short positions, your portfolio weights will all need to be positive numbers. In order to enforce this in the optimization problem, you would add the constraint that every x_i in the \mathbf{x} vector is positive .

no short selling:
\;\;\;\;\;\;\;\;0 \leq x_i \leq 1,\;\;\;\;\;\;\;\;i=1,2,\ldots,n

You may choose to impose constraints that would limit your portfolio allocations in individual sectors, such as technology or energy. You could do this by limiting the sum of weights for assets in each sector.

sector limits:
\;\;\;\;\;\;\;\;x_{\mathrm{biotech1}} + x_{\mathrm{biotech2}} + x_{\mathrm{biotech3}} \leq M,\;\;\;\;\;\;\;\;M = \mathrm{percent\;of\;portfolio\;to\;invest\;in\;biotech\;companies}

If your optimization objective seeks to minimize portfolio variance, you might also incorporate into the problem a goal for the total portfolio return. You can do this by adding a constraint on the portfolio return.

constraint on portfolio return:
\;\;\;\;\;\;\;\;\mathbf{x}^\mathrm{T} \mathbf{\mu} \geq r_{\mathrm{min}}, \;\;\;\;\;\;\;\;r_{\mathrm{min}} = \mathrm{minimum\;acceptable\;portfolio\;return}

Maximizing Portfolio Return

We can also flip the problem around by maximizing returns instead of minimizing variance. Instead of minimizing variance, it often makes sense to impose a constraint on the variance in order to manage risk. Then you could maximize mean returns, which is equivalent to minimizing the negative mean returns. This makes sense when your employer has told you, “I want the best return possible, but you must limit your losses to p percent!”

objective:
\;\;\;\;\mathrm{minimize:}\;\;-\mathbf{x}^\mathrm{T} \mathbf{\mu}

constraint:
\;\;\;\;\mathbf{x}^\mathrm{T} \mathbf{P}\mathbf{x} \leq p, \;\;\;\;p = \mathrm{maximum\;permissible\;portfolio\;variance}

Maximizing Portfolio Return And Minimizing Portfolio Variance

Indeed, you could also create an objective function that both maximizes returns and minimizes variance, and controls the tradeoff between the two goals with a parameter, b . In this case, you have two terms in your objective function, one representing the portfolio mean, and one representing the portfolio variance, and the variance term is multiplied by b .

How does one determine the parameter b ? Well, it’s very dependent on the individual and the situation, and depends on the level of risk aversion appropriate. It basically represents how much percent return you are willing to give up for each unit of variance you take on.

objective: \;\;\;\;\;\;\;\mathrm{minimize:}\;\;\;\;\;-\mathbf{x}^\mathrm{T} \mathbf{\mu}+b\mathbf{x}^\mathrm{T} \mathbf{P}\mathbf{x}, \;\;\;\;\; b = \mathrm{tradeoff\;parameter}

A Math Note: the L2-Norm

There’s another way to formulate an optimization objective that relies on a new piece of notation, so I’ll just take a moment to explain that now. Say we just want to minimize the difference between two quantities. Then we need a measure of the difference, but generalized into many dimensions. For portfolio optimization problems, each dimension is an asset in the portfolio. When we want to measure the distance between two vectors, we use something called the Euclidean norm or L2-norm. This is just the square root of the squared differences of each of the vectors’ components. We write it with double bars and a 2 subscript.

d = \sqrt{(a_x - b_x)^2 + (a_y - b_y)^2 + (a_z - b_z)^2} = \left \| \mathbf{a} - \mathbf{b} \right \|_2

Note that this reduces to the familiar Pythagorean theorem in 2 dimensions.

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Minimizing Distance to a Set of Target Weights

Back to portfolio optimization! One way to formulate an optimization problem is to use the L2 norm and minimize the difference between your vector of portfolio weights and a set of predefined target portfolio weights \mathbf{x}^* . The goal would be to get the weights as close as possible to the set of target weights while respecting a set of constraints. As an example, these target weights might be values thought to be proportional to future returns for each asset, in other words, an alpha vector.

objective: \;\;\;\;\;\mathrm{minimize:}\;\;\;\;\;\left | \mathbf{x}-\mathbf{x}^* \right |_2, \;\;\;\;\;\mathbf{x}^* = \mathrm{a\;set\;of\;target\;portfolio\;weights}

Tracking an Index

What if you want to minimize portfolio variance, but have the portfolio track an index at the same time? In this case, you would want terms in your objective function representing both portfolio variance and the relationship between your portfolio weights and the index weights, \mathbf{q} . There are a few ways to set this up, but one intuitive way is to simply minimize the difference between your portfolio weights and the weights on the assets in the index, and minimize portfolio variance at the same time. The tradeoff between these goals would be determined by a parameter, \lambda .

objective: \;\;\;\;\;\mathrm{minimize:}\;\;\;\;\;\mathbf{x}^\mathrm{T}\mathbf{P}\mathbf{x} +\lambda\left | \mathbf{x} - \mathbf{q} \right |_2, \;\;\;\mathbf{q} = \mathrm{a\;set\;of\;index\;weights},\;\;\;\lambda = \mathrm{a\;tradeoff\;parameter}

Lambda

Let's say you have two terms in your optimization objective, and lambda is multiplied to the second term. If you choose a larger lambda, do you think this causes the optimization to be influenced more by the goal of minimizing the first term or the goal of minimizing the second term?

SOLUTION: second term